import { stationControllerGetStation as getDetail } from '@/services/ess/station';
import React, { useEffect, useState } from 'react';
import { useSearchParams } from 'umi';
import BaseInfo from './components/BaseInfo';
import ParamConfigTabs from './components/ParamConfigTabs';

const ParamConfig: React.FC = () => {
  const [searchParams] = useSearchParams();
  const id = searchParams.get('id');

  const [detailInfo, setDetailInfo] = useState({});

  useEffect(() => {
    getDetail({ id }).then((res) => {
      setDetailInfo(res?.data || {});
    });
  }, []);

  console.log('detailInfo---', detailInfo);

  return (
    <div>
      <BaseInfo detailInfo={detailInfo} />
      <div style={{ marginTop: 20 }}>
        <ParamConfigTabs detailInfo={detailInfo} id={id} />
      </div>
    </div>
  );
};
export default ParamConfig;
